<include file="public@header" />
<style type="text/css">
    /*.maintenance{    list-style-type: none; float:left;width:60%}*/
    /*.mai：ntenance li{width:50%;float:left;height:30px;line-height:30px}*/
    tr td { max-width:80px;width:auto; }
    /*.content_nav .check_info{flex:1; display:flex;flex-direction: column;align-items: center;justify-content: center;}*/
    thead tr th{
        border: 0 !important;}
    .table-striped>tbody>tr:nth-of-type(odd) {
        background-color: #f7f7f7;
    }
</style>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('finance/supplier')}">对账列表</a></li>
    </ul>
    <form class="well form-search" method="get" action="{:url('finance/supplier')}">
        <label>供货商：
            <select class="form-control" name="supplier">
                <option value="">全部</option>
                <foreach name="suppliers" item="vo">
                <option value="{$vo.id}"<if condition="$supplier eq $vo.id">selected</if>>{$vo.user_nickname}</option>
                </foreach>
            </select>
        </label>
        <label>抵顶人：
            <select class="form-control" name="diding">
                <option value="">全部</option>
                <foreach name="didings" item="vo">
                    <option value="{$vo.user_nickname}" <if condition="$diding eq $vo.user_nickname">selected</if>>{$vo.user_nickname}</option>
                </foreach>
            </select>
        </label>
        <label>客户名称：<input  type="text" class="form-control" id="real_name" name="real_name" placeholder="请输入客户名称"value="{:input('request.real_name')}" > </label>
        <label>联系电话：<input  type="text" class="form-control" id="real_phone" name="real_phone" placeholder="请输入联系电话"value="{:input('request.real_phone')}" > </label>
        <label>受理时间：
            <input  type="text" class="form-control js-date" id="startData" name="start_time" value="{:input('request.start_time')}"  autocomplete="off"> 至
            <input  type="text" class="form-control js-date" id="endData" name="end_time" value="{:input('request.end_time')}"  autocomplete="off">

        </label>
        <input type="submit" class="btn btn-primary" value="搜索"/>
        <a class="btn btn-danger" href="{:url('finance/supplier')}">清空</a>
    </form>
    <div class="control-group1-p div_content">
        <!---tab页-->
        <ul class="nav_tabs" style="margin: 0; padding-top: 9px !important;height: 38px !important;">
            <li class="active" data-t="1"><a href="javascript:">对账明细</a></li>
        </ul>
        <form action="{:url('Rock/order')}" method="post" style="border-bottom: 1px solid #0b7ebf;border-left: 1px solid #0b7ebf;border-right: 1px solid #0b7ebf">
            <table class="table table-hover table-bordered" style="width: 100%">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>{:lang('付款编号')}</th>
                    <th>{:lang('抵顶人')}</th>
                    <th>{:lang('成交结算时间')}</th>
                    <th>{:lang('客户名称')}</th>
                    <th>{:lang('联系方式')}</th>
                    <th>{:lang('墓位编号')}</th>
                    <th style=" width: 15%">{:lang('具体位置')}</th>
                    <th>{:lang('销售价格')}</th>
                    <th>{:lang('成交价格')}</th>
                    <th>{:lang('供货商')}</th>
                    <th>{:lang('供货合同')}</th>
                </tr>
                </thead>
                <tbody>
                <foreach name="results" item="vo">
                    <tr>
                        <td>{$vo.id}</td>
                        <td>{$vo.pay_sn}</td>
                        <td>{$vo.reacher}</td>
                        <td>{$vo.add_time|date='Y-m-d H:i:s'}</td>
                        <td>{$vo.buyer_name}</td>
                        <td>{$vo.buyer_phone}</td>
                        <td>{$vo.tomb_num}</td>
                        <td>{$vo.tomb_region}</td>
                        <td>{$vo.total_price}</td>
                        <td>{$vo.deal_price}</td>
                        <td>{$vo.user_nickname}</td>
                        <td>
                            <a href="javascript:;" name="title" id="{$vo.purchase_id}" data-title="{$vo.pact_name}" data-supplier="{$vo.user_nickname}" data-parent="3" class="child-of-node-3">查看</a>
                        </td>
                    </tr>
                </foreach>
                </tbody>
            </table>
            <div class="pagination">{$page}</div>
        </form>
    </div>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js?v={:time()}"></script>
<link href="__STATIC__/js/bootstrap-table/dist/bootstrap-table.css" rel="stylesheet"/>
<script src="__STATIC__/js/bootstrap-table/dist/bootstrap-table.js"></script>
<script src="__STATIC__/js/bootstrap-table/dist/locale/bootstrap-table-zh-CN.js"></script>
<script type="text/javascript" src="__STATIC__/js/init_base.js"></script>

<script>
    $(document).on("click","[name='title']",function() {

        if ($(this).data("parent") != 3) {
            return;
        }
        var id = $(this).attr("id");

        var title = $(this).data("title");
        var supplier = $(this).data("supplier");
        $.ajax({
            url		: "{:url('Finance/getContract')}",
            type	: "post",
            dataType: "json",
            data	: {'id':id,'Ajax': 1},
            success : function(results){
                console.log(results);
                var html = '<div class="col-md-12"  style="border:1px solid #e2e2e2; padding-top:20px;">'+
                            '<div class="col-md-6">'+
                                '<label class="col-md-4">合同编号</label>'+
                                '<div class="col-md-6">'+
                                    '<div>'+results.pact_num+'</div>'+
                                '</div>'+
                            '</div>'+
                            '<div class="col-md-6">'+
                                '<label class="col-md-4">合同名称</label>'+
                                '<div class="col-md-6">'+
                                    '<div>'+results.pact_name+'</div>'+
                                '</div>'+
                            '</div>'+
                            '<div class="col-md-6">'+
                                '<label class="col-md-4">供货商名称</label>'+
                                '<div class="col-md-6">'+
                                    '<div>'+supplier+'</div>'+
                                '</div>'+
                            '</div>'+
                            '<div class="col-md-6">'+
                                '<label class="col-md-4">下单时间</label>'+
                                    '<div class="col-md-6">'+
                                        '<div>'+results.add_time+'</div>'+
                                    '</div>'+
                            '</div>'+
                            '<div class="col-md-6">'+
                                '<label class="col-md-4">交付时间</label>'+
                                '<div class="col-md-6">'+
                                    '<div>'+results.due_time+'</div>'+
                                '</div>'+
                            '</div>'+
                            '<div class="col-md-6">'+
                                '<label class="col-md-4">交货地点</label>'+
                                '<div class="col-md-6">'+
                                     '<div>'+results.trading_address+'</div>'+
                                '</div>'+
                            '</div>'+
                            '<div class="col-md-6">'+
                                '<label class="col-md-4">订单总价</label>'+
                                '<div class="col-md-2" style="width: 21%">'+
                                    '<div>'+results.total_price+'</div>'+
                                '</div>'+
                            '</div>'+
                            '<div class="col-md-6">'+
                                '<label class="col-md-4">到付运费</label>'+
                                '<div class="col-md-6">'+
                                    '<div>'+results.delivery_fee+'</div>'+
                                '</div>'+
                            '</div>'+
                            '<div class="col-md-6">'+
                                '<label class="col-md-4">税金</label>'+
                                '<div class="col-md-6">'+
                                    '<div>'+results.tax_price+'</div>'+
                                '</div>'+
                            '</div>'+
                            '<div class="col-md-6">'+
                                '<label class="col-md-4">下单人</label>'+
                                '<div class="col-md-6">'+
                                    '<div>'+results.user_nickname+'</div>'+
                                '</div>'+
                            '</div>'+
                            '<div class="col-md-6">'+
                                '<label class="col-md-4">订单备注</label>'+
                                '<div class="col-md-6">'+
                                    '<div>'+results.remark+'</div>'+
                                '</div>'+
                            '</div>'+
                        '</div>';

                RCABase.initBase.ajaxLayerOpen(
                    [title+'-合同信息', 'color:#383838;font-size:16px;'],
                    html,
                    ['750px','300px']);
            },
            error	: function(){
                alert("服务器内部错误，请联系系统管理员");
            }
        });
    })
</script>
<script type="text/javascript" src="__STATIC__/js/layer/layer.js"></script>
</body>
</html>